package cn.zt.service.impl;

import cn.zt.dao.StudentDao;
import cn.zt.model.Student;
import cn.zt.service.StudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class StudentServiceImpl implements StudentService {
    @Autowired
    private StudentDao studentDao;

    @Override
    public void addStudent(Student student) {
        studentDao.addPerson(student);
    }

    @Override
    public void deleteStudeng(int studentId) {
        studentDao.deleteStudeng(studentId);
    }

    @Override
    public List<Student> selectStudeng() {
        return  studentDao.selectStudeng();
    }

    @Override
    public Student selectOneStudeng(Integer id) {
      Student student =  studentDao.selectOneStudeng(id);
      return student;
    }

    @Override
    public String updateStudeng(Student student) {
        if (student.getName().equals("zt")){
            return "真帅";
        }else {
            studentDao.updateStudeng(student);
            return "修改成功";
        }

    }
}

